import 'dart:convert';

import 'package:flutter/cupertino.dart';
import 'package:uitest/model/details.dart';
import 'package:uitest/service/service_method.dart';

class DetailsInfoProvide with ChangeNotifier{
  DetailsModel goodsInfo;
  bool isLeft = true;
  bool isRight = false;

  changeLeftAndRight(String changeState){
    if (changeState == 'left'){
      isLeft = true;
      isRight = false;
    }else {
      isLeft = false;
      isRight = true;
    }
    notifyListeners();
  }


  getGoodsInfo(String id) async {
    var formData = {'goodId':id};
    await request('getGoodDetailById',formData:formData).then((val){
        var responseData = json.decode(val.toString());
        print(responseData);
        goodsInfo = DetailsModel.fromJson(responseData);
        notifyListeners();
    });
  }

}